package com.atde._03_creational_design_patterns.prototype.deepclone;

import java.io.Serializable;

/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._03_creational_design_patterns.prototype.deepclone
 * @Author: Del
 * @CreateTime: 2025-06-17  18:32
 * @Description: 原型模式 --- 深拷贝
 * @Version: 1.0
 */
public class DeepCloneableTarget implements Serializable, Cloneable {
    private String cloneName;
    private String cloneClass;


    public static final long serialVersionUID = 7897899964564646L;


    // 构造器
    public DeepCloneableTarget(String cloneName, String cloneClass) {
        this.cloneName = cloneName;
        this.cloneClass = cloneClass;
    }

    // 该类的属性，都是字符串String类型，我们可以直接使用默认的克隆方法即可
    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    public String getCloneName() {
        return cloneName;
    }

    public void setCloneName(String cloneName) {
        this.cloneName = cloneName;
    }

    public String getCloneClass() {
        return cloneClass;
    }

    public void setCloneClass(String cloneClass) {
        this.cloneClass = cloneClass;
    }

    @Override
    public String toString() {
        return "DeepCloneableTarget{" +
                "cloneName='" + cloneName + '\'' +
                ", cloneClass='" + cloneClass + '\'' +
                '}';
    }
}
